export default {
  js(data, callback) {
    let script = document.createElement('script')
    script.type = 'text/javascript'
    for (let key in data) {
      script[key] = data[key]
    }
    if (callback) {
      script.onload = function() {
        callback()
      }
    }
    document.getElementsByTagName('head')[0].appendChild(script)
  },
  css(data) {
    let link = document.createElement('link')
    link.rel = 'stylesheet'
    link.type = 'text/css'
    for (let key in data) {
      link[key] = data[key]
    }
    document.getElementsByTagName('head')[0].appendChild(link)
  }
}
